Section 30. No restriction shall in any proceeding be enforced or declared to be enforceable, whether or not the time for recording a notice or extension under section twenty-seven or twenty-eight has occurred, or such a notice or extension has been recorded, unless it is determined that the restriction is at the time of the proceeding of actual and substantial benefit to a person claiming rights of enforcement. There shall be a presumption that no restriction shall be of such actual and substantial benefit except in cases of gifts or devises for public, charitable or religious purposes, if any part of the subject land lies within a city or town having a population greater than one hundred thousand persons unless (1) such restriction at the time it was imposed is not more burdensome as to requirements for lot size, density, building height, set back, or other yard dimensions than such requirements established by restriction or restrictions applicable to the land of the persons for whose benefit rights of enforcement are claimed; or (2) such restriction is part of a common scheme applicable to four or more parcels contiguous except for any intervening streets or ways to land of the grantor or other premises purported to be benefited thereby; or (3) unless such restriction is in favor of contiguous land of the grantor. No restriction determined to be of such benefit shall be enforced or declared to be enforceable, except in appropriate cases by award of money damages, if (1) changes in the character of the properties affected or their neighborhood, in available construction materials or techniques, in access, services or facilities, in applicable public controls of land use or construction, or in any other conditions or circumstances, reduce materially the need for the restriction or the likelihood of the restriction accomplishing its original purposes or render it obsolete or inequitable to enforce except by award of money damages, or (2) conduct of persons from time to time entitled to enforce the restriction has rendered it inequitable to enforce except by award of money damages, or (3) in case of a common scheme the land of the person claiming rights of enforcement is for any reason no longer subject to the restriction or the parcel against which rights of enforcement are claimed is not in a group of parcels still subject to the restriction and appropriate for accomplishment of its purposes, or (4) continuation of the restriction on the parcel against which enforcement is claimed or on parcels remaining in a common scheme with it or subject to like restrictions would impede reasonable use of land for purposes for which it is most suitable, and would tend to impair the growth of the neighborhood or municipality in a manner inconsistent with the public interest or to contribute to deterioration of properties or to result in decadent or substandard areas or blighted open areas, or (5) enforcement, except by award of money damages, is for any other reason inequitable or not in the public interest.
Nothing herein shall prevent a court from issuing a temporary injunction or restraining order pending determination of enforceability of a restriction.