UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xX3LPZAPDLLgMostb7vEXN7XEgVa1V8CFizWRGs7Hlw=' 
WHERE 
  key_id = 'ed4b43b114c79c96d5a8afa1e40e8b85055dacc117e37bc18479c3d3908295c4' 
  AND (
    token = 'xX3LPZAPDLLgMostb7vEXN7XEgVa1V8CFizWRGs7Hlw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043