Any lot lawfully laid out by deed duly recorded, or any lot shown on a recorded plan endorsed by the Planning Board pursuant to MGL c. 41, § 81P or 81U, which complies at the time of such recording with the minimum area, frontage, width, and depth requirements, if any, of the zoning bylaws then in effect, may be built upon for residential use provided it has a minimum area of 5,000 square feet with frontage of at least 50 feet and is otherwise in accordance with the provisions of Section 6 of the Zoning Enabling Act.