Agree with susan this cannot be allowed to continue. My ds had/has huge anxiety about toilets too, and ended up really ill (serious vomiting) with a bladder infection last term as he was holding it in for hours.
They need to come up with a strategy for helping him through this.
First thing is to allow him to go during lesson times if he needs to and stop timing him immediately - that is not just counter-productive but downright cruel
Talk about placing extra stress and anxiety on him ffs! And allowing him to go outside set times is just called accommodating his SN - refusal to do so could be called discrimatory. Not suggesting you go in all guns blazing about this but have it up your sleeve if school get difficult.
In my ds's case, we have put in place a reward-based system, and are taking things step by step. First thing was getting him to just spend a bit of time in the toilet, with no demand to use it. Did this by making games - eg hiding toys in there, getting him and a friend to find them. When he was comfortable being in there (at first he was like yours and didn't even like being in there when other children were there as it was crowded etc), it moved on to using the loo. At that point, no demands for flushing (though he did have to wash his hands). Then flushing. At each stage, he was rewarded.
Now we still have a token system, where his TA will give him a token for 5 minutes on the ipad (when he gets home) each time he uses the loo.
Not sure of your ds's age or situation re statement but would something like this work do you think? How supportive are school generally?