Update password only when necessary