UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ksVabcriSPhBF+DBDISmgzMJ7cqGXkt3lIUuKEfrQ6Y=' 
WHERE 
  key_id = '87cc45850e9f73f815e07e22cc628f4160e12347eeb9ee657c08440f54d4f80e' 
  AND (
    token = 'ksVabcriSPhBF+DBDISmgzMJ7cqGXkt3lIUuKEfrQ6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016