How to update a Redis value without affecting the remaining TTL

Very self explanatory title, this beauty it's a Lua script running inside Redis interpreter, it will basically grap the ttl from the passed key if exist (ttl > 0) and use it which means that we are overriding the key or if not will just setex the key with the passed data and ttl.