If the spindle has a brake (not necessarily a "lock") then you should be able to command it at any given time after tool change. If you have an ATC and it's a flange taper machine (like CAT, BT, HSK (some forms), etc), it should "lock". Code it here:
%
O02500 (CORNER BROACHING)
N1 G20
N2 G00 G17 G40 G49 G80 G90
N3 T1 M06 (broaching tool)
N4 G00 G90 G54 X-0.25 Y0.25 M08
M19
N5 G43 H1 Z0.1
N6 G01 Z-1.0 F20
N7 Z0.1F100
N8 M09
N9 M30
%
You can check it by hand to make sure it "locked". Just be careful because "lock" and "brake" are two different things. Generally, "lock" is a different M code but most verticals don't have this. Need to be sure you don't overcome the brake when broaching. Might need to add a bit of dwell if your machine starts moving before orient is complete.
As for releasing it, some MTBs write in the ladder to release the brake when commanded a M5. Some release if you command a M3S0. For sure if you command a M3 with a low speed (like S30) then the orient will release. But if all you're doing here is broaching with this tool, then you don't need to release it. Just tool change to the next tool and move on.
note: Another option some spindles have is the ability to orient to a specific angle. Generally something like "M19S900" for example would orient the spindle at 90°. Codes can change a bit depending on the builder. Not all machines have this. There's another way to do this through parameters which you can write over then change back in a program but that's a bit more sketchy if not careful.
It's just a part..... cutter still goes round and round....