UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lVQgMjENgp9F7HoJr0CLMGiNoOujzpdP11yA67S3+AI=' 
WHERE 
  key_id = '33e0ce55a5e0e21059af6e18f8f079c3fc78a83683e3f095eebdf76c5587a547' 
  AND (
    token = 'lVQgMjENgp9F7HoJr0CLMGiNoOujzpdP11yA67S3+AI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035