When. As a general supplication, and it belongs particularly to the moments when a person takes stock: an illness, a birthday, a diagnosis, the end of a long project. It asks about endings rather than about length.
The words. Aqibah is the key. Its root gives the verb for following behind — the same root behind aqib, the heel of the foot. An aqibah is what comes after, the outcome that trails a matter and settles what it was. Asking ahsin aqibatana is asking for a good ending, not a good middle, and fil-umuri kulliha, 'in all affairs', refuses to limit it to the affairs one is currently worried about. Then khizy: not pain or loss but disgrace, being exposed and humiliated in front of others. The supplication pairs it with adhab, punishment, in the next world. Two evils, one in each realm, each named with the word that fits that realm.
Why endings and not length. Everyday speech treats a long life as the good outcome. This sentence quietly reorders it: the value is in how a matter finishes. A short affair that ends well is what is being asked for, and a long one that ends badly is what is being sought refuge from.
The plural. Every verb is 'us', not 'me'. Said as it stands, a person is asking for his household and everyone in the same situation, and cannot make a private exception of himself.
A note. It fixes no outcome and names no number of years. It asks only that whatever comes, comes to a good end.