A mortgage in principle MIP/ agreement in principle AIP or mortgage promise will be valid for between 60 to 90 days from initial application. This is an initial estimate from a lender stating what you may be able to borrow subject to underwriting.
If the certificate expires before you need it you can always reapply. However, be mindful that too many searches could damage your credit score.