Any locality may, by ordinance, regulate a retail tobacco establishment, as such term is defined in § 4.1-100, a retail sale location of tobacco products, as such term is defined in § 58.1-1021.01, or a retail sale location of hemp products intended for smoking, as such term is defined in § 4.1-600, and may prohibit such establishment or location on property within 1,000 linear feet of a child day center as defined in § 22.1-289.02 or a public, private, or parochial school. An ordinance adopted pursuant to this section shall not affect (i) a licensee holding a valid license under § 4.1-206.3 or (ii) any retail sale location of tobacco products, hemp products intended for smoking, or retail tobacco establishments operating before July 1, 2024.