Lock in as many of the costs you can, the rate as well as points. In this market, that would almost guarantee you a higher rate. Shop around for both the terms of the lock contract and its cost. Others might charge the fee at settlement. The fee might be a flat fee, a percentage of the mortgage amount, a fraction of a percentage point or a higher interest rate.
Some lenders offer the service at no cost.
How much you pay will vary among lenders depending upon the length of the lock-in period, the options you choose, and whether the mortgage rate is fixed or adjustable and if it's a purchase or a refinance. The lock-in period should be long enough to allow for settlement, contingencies imposed by the lender or purchase contract and other factors that could delay the process. Most range from 15 to 60 days. Anything longer could be cost prohibitive. Consider all factors that could delay your settlement, including the time it will take you to provide requested materials about your financial condition, unanticipated construction delays on a new house and the like.