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

Query time 0.00036