You can lock it many ways.
Locking based on run hours or a calendar date are a couple.
The critical code & associated tags would then need to be source protected,
so it cannot be seen or reset by adjusting the tag.
I have seen where the client can pay for different options in the code
& they get a password to enable them or extend the run time.
One had a countdown on a screen,
"Program will time out in x days, call xxx-xxxx to unlock."
As mentioned above, the end user must know about it.
I have been paid to unlock a protected PLC before when the integration company
would not give it up & the machine was messing up.
Newer PLC's are considerably harder if not nearly impossible to hack when protected.
One of the funniest ones I ever saw was if you duplicated the code
into a 2nd PLC the SCADA would only show dancing girls on the screen.
It had everybody laughing. But that would probably get HR involved these days.