Add locking to prevent concurrent execution of multiple update tasks