UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FDvesA4lCNgFtoyZacDa6HYheQkZoeNanrheIawTisc=' 
WHERE 
  key_id = '9d157223256a58cbb4bd556da511b372bf12353f96dc85d7913772a1d409962d' 
  AND (
    token = 'FDvesA4lCNgFtoyZacDa6HYheQkZoeNanrheIawTisc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038