Like everything else from cycling to weights to drawing, it takes practice and consious effort. Do it everyday until it becomes a habit wired in your brain. Buddhist monk Thich Nhat Hanh suggests we practice it first thing it the morning when we wake up (smile and give thanks), when we brush our teeth, when we use the toilet, when the traffic light turns red, when we are in a queue, before we answer a call, before we reply an email....
Practice deep breathing or recite positive mantras/prayers untl it becomes your second nature.
Then, there will be a time when you can do it.
Thich Nhat Hanh's books, in particular 'Touching the Earth' and 'Breathe! You are alive!'