As noted by @JoelK there was an entire Seforimblog post devoted the the provenance of this aphorism. To summarise the post and list the pre-19th century sources for it, the Yossif Omets (printed in the early 18th century) here states a version of this:
אנוש מה תדאג ותעיין, העבר אין והעתיד עדיין, וההוה כהרף אין, אם כן דאגה מניין.
An earlier compendium מראה מוסר (published in 1677) quotes an expanded version:
אנוש אח קין. מה תדאג ותעיין.
בהפקד קנין. ורוב ענין
במשקל ובמנין. הכל הבל ורעיון.
העבר אין. והעתיד עדין.
וההוה כהרף עין. אם כן דאגה מנין
Notably, the idea that the past is gone, the future non-existent, and the present vanishing is generalised by the Sefer HaIkkarim (3:27) (as noted in the comments to that Seforimblog post) who notes that time is composed of an infinite sum of infinitesimals that themselves have no magnitude (he does not however connect this to not worrying):
כי כמו שהזמן הוא דבר בלתי נמצא בפעל, כי העבר אינו נמצא והעתיד לא יצא עדיין אל הפעל וההוה אינו אלא העתה הקושר בין העבר והעתיד, ואולם העתה עצמו אינו זמן על דרך האמת שיקבל חלוקה
The issue of time being composed of durationless units was really anticipated by Zeno almost two thousand years before the Sefer HaIkkarim, with many of his paradoxes predicated on the fact that motion, time, and space, are all composed of infinitesimals. For example, the arrow paradox notes that at any given point in time, an arrow in flight is motionless. Accordingly, it never moves. Importantly, it too does not address worrying.
One interesting older source that connects the nature of past, present, and future to behaviour, is the Bhaddekaratta Sutta which cites Buddha as saying:
What is past
is left behind.
The future
is as yet unreached.
Whatever quality is present
you clearly see right there
This has a different conclusion though. Rather than not worrying about the present, as it is part of a life composed of fleeting insignificant infinitesimals, we are encouraged to embrace the present given the insignificance of the past and future. In context, this is somewhat similar teaching of אם לא עכשיו אימתי.
This is more similar to the Rav's take (cited there) that one must focus on the present.