UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vtdyCabfy9iV7UBFrcJcjq70bpSEHE3Ms92NP8aYYA4=' 
WHERE 
  key_id = 'b0045cff575f9ee53b1811c2da4438b052641e8e57f130f602e7864eb1b5657b' 
  AND (
    token = 'vtdyCabfy9iV7UBFrcJcjq70bpSEHE3Ms92NP8aYYA4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027