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

Query time 0.00016