A rate lock is the amount of time that a lender will guarantee a loans interest rate.
Be sure to lock an interest rate for long enough for closing. A rate, however low it is, is useless if you cannot close the transaction within the ratelock period. Some dishonest loan officers purposely offer to lock at lower rates to induce your business, but for a short ratelock period knowing you cannot close the loan within said ratelock period, only to re-lock at a much higher interest rate after the original lock expires.
If you decide to lock in your rate be sure you ask for a copy of the confirmation. This form will show what the rate is, when it was locked, and when the lock expires. The expiration should be at least a day after the scheduled FUNDING date. The funding date for a purchase is the closing day, however on a refinance the funding date is not until after the rescission period ends.
If you are purchasing a home, it is important that you request a lock which expires after the anticipated closing date, and build in a little bit of a cushion.
Also, be sure to ask your mortgage professional what might happen if you do not fund by your lock expiration date. Different lenders have different policies when dealing with a rate lock expiration. Some lenders will take the higher of the 2 rates, while others may give you the option of an extension for a small fee at closing. Be sure you know your particular lender's rate lock policy and lock accordingly.
Most lenders allow rate locks to last 21, 30, or 45 days, and depending on the length, the rate is usually effected. The shorter the rate lock, typically, the better the rate.