Toilets being locked was brought in in my last couple of years at secondary.
In theory, locked during lessons (so you had to ask then go to the office for a key and a teacher would guess as to whether you needed it or not)..
Open at break times/lunch time.
However, 3 toilet blocks over 2 floors - one person was supposed to trot around opening them.
YOu never actually knew when he would and which toilets - at break time you could in theory spend the whole break waiting at a block that wouldn't get opened and no way of knowing this (pre mobile phone days!)
At lunchtime, we had long queues for lunch, so you might be waiting for a toilet then it was time to queue for your lunch sitting, do you wait for the loo or risk no lunch through either missing your sitting (we had a card that told the lunch ladies what sitting we were on, miss it, miss out!), or being last in and there being no actual food left.
And again you could wait pointlessly at the wrong loo that was never unlocked. Some breaks/lunchtimes, the loos just wouldn't be unlocked at all because the caretaker with the key forgot/was busy elsewhere/had delegated to someone else who forgot.
It was also risky to eat your lunch then bank on the loos being open as even if they had been opened, depending which way around the building the caretaker went and which you chose, it might well be locked again by the time you get there, as he went round locking up before the end of lunchbreak.
So parents might well be told the toilets were available all lunch and dinner, in reality they rarely were in a way that meant all kids actually had a fair chance to access them!