UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJVTF6zmjZZmp8rC2RDjKlBekpU5L+4ur1DlL/ALC54=' 
WHERE 
  key_id = '6a5637d8f9a448c5c78b9798226e1661027d209e03992129a09b3153ddba7417' 
  AND (
    token = 'XJVTF6zmjZZmp8rC2RDjKlBekpU5L+4ur1DlL/ALC54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040