UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tc/PecHAxfwzJgttoXpQOaNImKnTmGKYc6FJJQEWNNI=' 
WHERE 
  key_id = 'cefecdd134e5fbb52d98cf35921744da5511970261eff3a61243713fb385a55d' 
  AND (
    token = 'Tc/PecHAxfwzJgttoXpQOaNImKnTmGKYc6FJJQEWNNI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044