I installed both xautolock and slock. slock doesn't display the password input screen (I only saw a coloured screen) so I think I'll pass. By the way I can lock the screen from the terminal using the command "mate-screensaver-command -l" and activate the screensaver I selected using mate screensaver using the command "mate-screensaver-command -a" and can do both lock and screensaver activation using the command "mate-screensaver-command -al" so adding a sleep command before it should be similar to your suggested command.
Running a command pretty much defeats the purpose of the computer figuring out that it is idle and locking itself after a few minutes.
In my case, I have it run via startup in JWM, via script.
You could I suppose, do the same with any other DE and some WM.
Also, you can make a python bash script,
So yeah, xautolock + slock can work for your use case. Unless you need to be able to display the password input screen, which is less secure anyways.
HyperbolaBSD: The Future of Secure Libre Lightweight Operating Systems!