For example if I defeat opponents Pokemon with moxie Salamence and then mega evolve it will my Salamence be at +1 ATK or the moxie buff will fade?
Althought the Ability will change upon Mega evolving, the stat boosts of certain Abilities will remain, as they are indirect. Moxie and Speed Boost give 'normal' or 'indirect' boosts to stats, much like moves does. The stat is raised the same way as if you had used Howl or Agility. Changing abilities dont effect these stats, and as such they stay until you switch out the Pokemon. This does not apply to all abilities however. Abilities that give a power boost directly such as Huge Power or Aerielate wont remain when changing Abilities. Source: Experience and http://replay.pokemonshowdown.com/pokemondatabase-ubers-10575
Because Salamence gets a different ability when it Mega Evolves, yes, the Moxie effect will be lost when you Mega Evolve to get an Aerilate Salamence.
I believe this is the case with all Mega Evolutions as all of them get a different ability when they evolve, but if I'm wrong I hope one of you can correct me.
Hope I helped. :) Source