Timing light reads ignition timing, which isn't totally related to the timing belt. However, if you have never had the timing belt replaced (recommended by Mazda every 60k miles) then you could have slipped some teeth and caused the overall timing of the engine to go off causing the smog-check failure (I had this happen to me on my car 2 years ago.)
Is your CEL (check engine light) on? If so, you should address these issues before going through other repairs.
Anyway, to answer your question, a replacement timing belt can cost $500-800 from what I have seen when done at a shop. It's much cheaper if you can do it yourself. While you are getting this replaced, it's adivsed to replace the timing belt tensioner arm (hydraulic part) and the waterpump since they are in the same area. If the car is very old, you may consider getting a timing belt kit, which replaces the idler pulleys in there as well.