Better/improved is a multi-axis comparison. Do you think you can make it faster, smaller, more resource efficient, more readable, more useful information, more precise results, more flexible, more general, able to run on more systems, eliminate a dependency on a separate product?
Why should your company pay you to spend time rewriting this code, instead of writing new code or rewriting some other piece of code?
You should make improvements as opportunity presents itself, but opportunity means that you are either already working on the code, or you've indentified a business reason to make the change.
Pushing a change to production introduces a non-zero chance of breaking things (unit and functional testing only reduce this chance, they do not eliminate it), and should only be done when the expected benefit outweighs the risk.
Which is another point to consider -- do you INTEND to push this change to production, or simply to the development branch? The bar for the two scenarios are completely different. If it is only going in the development branch, and may never get into production, then opportunity basically means you're looking at the code for some reason, and it's not time consuming to do. It can be reviewed as required if a push should ever happen, and left out if it is considered unwarranted at that time. If on the other hand, it's going to production now, as I said above, you need to consider if this change is worth the cost: in terms of time spent making the push, and the benefits of using the new code.