With limited insight into the overall process this may sound like I am asking a silly question so forgive me please, but why not push all the necessary data changes to the table in the INSERT? i.e. why INSERT 40K rows then turn around and immediately update them all?
There are no special teachers of virtue, because virtue is taught by the whole community. --Plato