UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Upf5l3UWQSrNoHqqlCSBw9RazOHkZsVqr42gjpQhJQw=' 
WHERE 
  key_id = '0b2f0b13bcb4b743c7487280e310c9f18a361212fba1b1660b14e60e65715537' 
  AND (
    token = 'Upf5l3UWQSrNoHqqlCSBw9RazOHkZsVqr42gjpQhJQw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031