Abstract mutex management to per-key across store implementations

Having a global mutex locking all store keys was causing huge problems with copies. This change simplifies the store api, whilst complicating the actual underlying store code. It has caused me pain.