fix broken lock mechanism (#70764)
This locking mechanism was meant to ensure only one caller can access the cache for the provided cache key at a time. In practice, subsequent calls to acquire the lock will immediately skip over the resolved promise and acquire the lock without exclusivity.
This ensures that when a lock is released, we delete it from the locks map. And when a lock is acquired, we create a new pending promise.
This doesn't appear to be causing any observable bugs (as far as I can tell) but should be corrected.