UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5YstIYi9N51mwBedjUlaGBKsf1Y7mGa6qFxMcxigqMc=' 
WHERE 
  key_id = '316692100fefd431fbcf7337c7d79d52563ff522bc268a7cfce38e812a35c521' 
  AND (
    token = '5YstIYi9N51mwBedjUlaGBKsf1Y7mGa6qFxMcxigqMc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027