UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UpXtDYnO2Z1QN596NlmIZHa7//S4fggdQ7qqYgTczok=' 
WHERE 
  key_id = '536afe399f0a27a75baf5c85e8f0f62bf573edac70ae4e1c235a4d68d95d59f5' 
  AND (
    token = 'UpXtDYnO2Z1QN596NlmIZHa7//S4fggdQ7qqYgTczok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020