Windows
Win+L
Or
ctrl-alt-del then choose the [lock computer] button.
Mac
Set screensaver option to ask for password
And then use one of your screen corner as a way to activate screensaver
That's all.
Every time you need to leave your mac, just move your mouse to that particular corner.