The most basic, straight forward way to to this would be to have a view or n1ql query that gives you every document key that need to be updated and then use the getAndTouch method.
As of now it’s not possible to set the TTL directly with N1QL. Maybe @geraldss can tell us more on this.
It should be pretty straightforward to issue a N1QL query and then update each of these documents through an .upsert() with the new TTL. I don’t know what SDK you’re using @dzagieboylo, but this could be as simple as creating a job queue for all of the keys/id’s returned.
If you want to get more sophisticated or it’s a large dataset you want to transform quickly, a little RxJava or the Spark connector with a N1QL query may work well. I have a blog on doing data transformation that may be worth reading.