IF you need to use a locker and IF there is a line (the wait for lockers was longer than the wait for the ride when I was there are the end of August

) DO NOT wait in the line.
Go through Filch's (to the right of the castle) and into the lockers that way. You will get a locker without having to wait.