prevent race condition when handling expired locks