UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sc7Vu5ea7UiERlp9PiGxzUZT2IL1TfzO+/vn+Q4Dkeg=' 
WHERE 
  key_id = '144af1f48901b79d140a0b7155f12bc6b6d99755127ae90328da8f9e47146698' 
  AND (
    token = 'Sc7Vu5ea7UiERlp9PiGxzUZT2IL1TfzO+/vn+Q4Dkeg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041