Unopened, the jar is shelf-stable at room temperature as long as it's kept in a cool, dark cupboard away from direct sunlight and heat sources. The sugar content and acidity from the lemon juice act as natural preservatives, which is typical for traditional cone and fruit syrups.
Once opened, transfer the jar to the refrigerator. The cold temperature slows any potential mold growth or fermentation. Always use a clean, dry spoon when scooping — introducing crumbs, butter, or moisture from a used utensil can seed spoilage. Keep the rim and lid clean, and screw the cap on tightly after each use.
Under proper refrigeration and clean handling, the syrup should remain good for several weeks to a couple of months. Signs it's time to discard: visible mold (even on the surface), off smells (fermented, yeasty, or sour beyond the normal lemon tang), fizzing or bubbling when opened, or a change in texture to overly thin or separated liquid. When in doubt, throw it out — the cost of a jar isn't worth a foodborne illness.
If you don't use it often, consider decanting a small portion into a smaller clean jar for frequent access, leaving the main jar sealed and refrigerated until needed.