UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LMWfBiNiSyDa4QFT/+mIgx3hQ2Koe7D22Cs+xyUNukw=' 
WHERE 
  key_id = 'd63d4586947765ed49ae244afd0bb569d1e5d2ceaeb36de034d0e8c334ee8d19' 
  AND (
    token = 'LMWfBiNiSyDa4QFT/+mIgx3hQ2Koe7D22Cs+xyUNukw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059