1. Go to Settings >> Phone>>Phone mgmt>>Security>>Phone and SIM card
2. Go to Lock Code (default lock code in any Nokia is 12345, click on lock code and change the code to whatever you want to)
3. Go to Phone autolock period (if this is set to 'None', your phone will not ask for a password while unlocking. Set this to what ever you want)