Yes, for the locker. Some hostels keep the backpacks or daypacks in a safe, where you don't need a lock. The lock can be used for the backpack when in the train or bus. You don't want pickpockets to help themselves !
I personally don't recommand to keep the important stuff in the daypack. I know a few people who were stollen, either the whole pack, or just the wallet (that was my case...!). A money belt might sometimes be annoying, yet some are very comfy and you kind of forget them, but it can save your trip !
I was in the countryside of Laos when my wallet disappeared, and only could get a new credit card three weeks later, sent at the canadian embassy in Vietnam ! Fortunately, I had $100 (half euros, half dollars), my passport, the plane tickets, insurances and visas with me. So I enjoyed the trip with no worry at all. When I got home, I shopped all my i.d. back.
But you can travel with the «magical thought» that nothing could happen to you...