The default desktop in Raspbian has a little icon in the bottom-right corner that looks like it should lock your screen, but doesn’t seem to do anything when clicked. Turns out, that’s probably because you don’t have screensaver installed.
$ sudo apt-get install xscreensaver
Now you can lock your screen without having to log out.