UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'twJH97q1QI6KsnPNPyQ03D46Fo0OPuuthG4HKMWuGGE=' 
WHERE 
  key_id = '436e56d11db00ecd5d73431de6b2a2f0ff57cf695d23024a79c772dc732321f8' 
  AND (
    token = 'twJH97q1QI6KsnPNPyQ03D46Fo0OPuuthG4HKMWuGGE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050