If you have two custom actions, one for the locking and one for unlocking, you could use the
SWS Cycle Action editor to make one toggle action for them. That toggle action you can then set to a toolbar button which will show the toggle state.
Something like this: