UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1YVH2UuqxPeSMC0/Tgr0PFICeX0eOU4EGokrXm2Mjlg=' 
WHERE 
  key_id = '89c877f95ab71ee26a5cf42fba398c4cd1e288bce22ca5b32f226b4f9c96d546' 
  AND (
    token = '1YVH2UuqxPeSMC0/Tgr0PFICeX0eOU4EGokrXm2Mjlg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029