UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2cIT30FY4sclxSKLIjy0zZIcV19IRwi0vQTKjTCUq+E=' 
WHERE 
  key_id = 'd86842ad1765aa7e2590227073ed71d5eb73fbb6a65864f3565bde3b7fa193ec' 
  AND (
    token = '2cIT30FY4sclxSKLIjy0zZIcV19IRwi0vQTKjTCUq+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048