In short, lease or leasehold agreements are contracts in Thailand and are not regulated by law. A maximum of 30 years is accepted by the courts.
Long text from https://www.thailandlawonline.com/thai-real-estate-law
When it comes to renting or leasing property in Thailand, foreigners have the same rights as Thai nationals. Renting of immovable property (land, house, condominium) for residential purposes is regulated by the Civil and Commercial Code (Sections 537 to 571) and further specified by the Supreme Court of Thailand. Foreigners are allowed to lease property for up to 30 years under Thai law. Whether it is renting an apartment or land and/or house for residential purposes by foreigners, there is no need to bring foreign currency into Thailand, unlike buying a condominium or leasing commercial real estate under the “rent of immovable property for trade and industry under the Aliens Act”.
Legally, a long-term rental or lease agreement under Thai law is best described as a prepaid lease. Leasing is listed in the Thai Civil and Commercial Code under the Special Contracts chapter, which means that it is not a property right (asset) or a real leasehold right, but a personal contract right primarily associated with the lessee is. Leasing in Thailand is not a fixed asset. A rental agreement in Thailand can be terminated early (breach of lease), cannot be pledged, is not automatically inheritable under the Tenancy Law Act and the tenant only has a statutory right to sublet and assign the remaining term of a rental agreement if this is stipulated in the rental agreement. The assignment of the lease always requires the cooperation and consent of the owner of the property and registration with the Land Department (which can only be done by the Thai owner).