I have steam running in the background when computer is not sleeping but I was wondering if Steam will download games when my computer is locked/sleeping.
If your computer is locked, that means that your computer is running but that you will be prompted for a password when you go to use it next. In this case, Steam will continue downloading your games as long as the computer is running, e.g. unless the computer falls asleep.
If you put your computer to sleep manually or if it falls asleep automatically after a while, that means that your computer's CPU and some other components more or less turn off. If your computer is asleep, all of your running programs are effectively paused in a suspended state, and Steam will definitely not download games.
I did it last night and I can 100% confirm that, yes, they will download in sleep mode on PC.