I currently received a request in which the document/folder should be locked after (x)days (after the created date). Is it possible to enforce document/folder locking?
You can enable In Place Record Management Feature on your Site Collection, and configure the record declaration settings in such a way that those document which are declared as records are not allowed to be either edited or deleted (locked to be precise.) as shown below:
Go To Site Settings -> Site Collection Administration -> Record Declaration Settings
Next, set up Information Management Policy Settings on your document library for the Content Types Document and Folder
Add a new retention stage and configure it as shown in the image below:
You should be able to achieve your requirement this way in a completely out of the box manner. Alternatively you write a Timer Job in order to achieve the same thing programmatically.
You could certainly remove all the edit permissions from the document. Meaning people could then still read, but not modify. Of course you could remove all read permissions too, but I imagine your administrator would need visibility of this.