update query to enforce ordering