Less than two years ago Gitlab enforced lifetime limits on tokens. Each token had to expire within 365 days after its creation (this was prolonged to 400 days later). Only Service accounts kept the possibility of creating tokens without expiry date.
Gitlab has an API call to rotate tokens - which is definitely preferred way instead of having one token laying around for many years. But for dev and personal things it makes the task more complex. Fortunately somewhere around version 17.x an option was added for admin to disable requirement of expiration dates for tokens.
To allow token without an expiry date go to Gitlab Admin page -> General -> Account and limit
and on that page uncheck the Require expiration date
checkbox. From now on new tokens can be created without an expiry date.