Reduce the risk of race conditions on counter cached foreign key update