LPS-44142 Properly ordering update and query to avoid version conflict

CC @arbetts and @hhuijser

This should be the proper fix for the issue. Please double check to make sure the issue is fixed. I did it by analyzing, did not do a proper test.