UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NiXRCZ6alnER+hVyVcPCuAu7a3aoW6Tt5PpI1dzAJyc=' 
WHERE 
  key_id = '9035416c338f1d20c4d437bf763cca73f23b7881e2d8c6168c678b224c5237cb' 
  AND (
    token = 'NiXRCZ6alnER+hVyVcPCuAu7a3aoW6Tt5PpI1dzAJyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030