select and update in one query