I have heard a simalysimile which give some insight around this question. It goes like this. Think aboutSuppose that you have a big bag with black and white pebbles. The black pebbles are the bad "Karma" and white are the good "Karma" which you have done in your fastpast. When you do an act of merit, you add one withewhite pebble to your bag. Add a black pebble withfor unwholesome acts.
So if you can fill the bag with lot of white pebblepebbles ( wholesomewholesome acts), there is a high chance that you would get a white pebble (Goodgood karma) from your bag. In other words you import your good karma by doing the good acts.
I think when it comes to kammakarma, the basic idea is "chetana" is the most important aspect. I hope you have heard the quote "chetanaham bhikkawe kamman wadami". So with the insincere actions, there can be some good karma from the action, but as the "chetana" is not pure, the power of kammakarma is lesslesser, according to my understanding.