Mortgage demand reached its lowest level in about 30 years, as high borrowing costs kept potential buyers away.