An optimal Itô formula for Lévy processes