The attached IDML holds several layers. A locked and an unlocked layer on page 1 and a locked layer on the Master Page A.
When you now switch to the Master Page and try to unlock the layer Masterlayer, you'll experience that this is not possible. Go back to page 1, detach the Master page and now you can unlock all layers.
lockedlayers.idml