UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k9rIE2pgdueQa/r4tPo6z1vqVauMXULKfCLI+E+YO9w=' 
WHERE 
  key_id = '2fec4c344f12ebccc4503e7128bced19e330b690d2bd4d10731a88a6b841754f' 
  AND (
    token = 'k9rIE2pgdueQa/r4tPo6z1vqVauMXULKfCLI+E+YO9w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031