AUTO-442: modify_state locking

If and when multiple server executions try to update the state at same time, only one of them gets the lock and state remains inconsistent. Also, this causes problem when multiple policies of same group are executed almost at the same time by scheduler.  The wait time of each lock acquisition is randomized since they may not get lock since each of them wait for same amount of time.

TODO: Update tests