UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XZ9ZTgYkGMHmioAmas1BTSY10olC2WdECPOKOGsFvWo=' 
WHERE 
  key_id = '586352c81eca22986b093b298706cdf666102cd9efe2013f1ba896249b361e74' 
  AND (
    token = 'XZ9ZTgYkGMHmioAmas1BTSY10olC2WdECPOKOGsFvWo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025