UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aHHiOYiefvNh+CI/MxoAi3iP9g017ecfBofJgtUlLnQ=' 
WHERE 
  key_id = '9d834a22bc82f3a194d373e9b91e43197be5dd74d613074adddb38baa317020b' 
  AND (
    token = 'aHHiOYiefvNh+CI/MxoAi3iP9g017ecfBofJgtUlLnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033