UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XD7YyU1N48f48y6Me3cvMS/P5MiI442Jv4J3AO3fje0=' 
WHERE 
  key_id = '9ceb9eeec58d380d461bc4d56fd69ba091a447b5995ff3e64419d698386665c3' 
  AND (
    token = 'XD7YyU1N48f48y6Me3cvMS/P5MiI442Jv4J3AO3fje0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041