UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tivxUTSITbPDaU1fkGACbi6iuCJMFHvP+fhiKURP+O0=' 
WHERE 
  key_id = '35ef289c0d73138cd0a92631e854b27a275bb1f1170a36f69a813e97cdd4e6dc' 
  AND (
    token = 'tivxUTSITbPDaU1fkGACbi6iuCJMFHvP+fhiKURP+O0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029