What you mean with your statement below?
"Optionally,you could run the command in recovery if you don't want to root“
Could you explain more specific?
Want to use your code to be "Locked“ but don't want to root or install custom recovery again.
Clean stock rom, no root and locked.
Keep s-off absolutely.
In fact, you don't even have to replace stock recovery if you're currently unlocked, as you could just fastboot boot it, run the command, and then be locked (though to undo this you'd have to flash a custom recovery via zip, since being locked prevents fastboot flashing of images).