how to use select and update together in mysql