Because the interest rate market fluctuates constantly and is subject to quick movements without notice, locking in a mortgage rate with a lender certainly protects you from the time your lock is confirmed to the day it expires.
Lock-ins make sense in a rapidly rising rate environment or when borrowers expect rates to climb during the next 30 to 60 days, which is typically the amount of time a lock-in remains in effect.
A lock-in given at the time of application is useful because it may take the lender several weeks to prepare a loan application. These days, however, automated loan practices have cut the time quite a bit.
Lock-ins are not necessarily free. Some lenders require you to pay a lock-in fee to guarantee both the rate and the terms.
If your lock-in expires before you close on the loan, most lenders will base the loan rate on current market interest rates and points.