Melt the butter and cook the onion, carrot and celery for 8-10 minutes until softened. Add the mushrooms if using and cook a further 3-4 minutes.
Stir in the flour, cook 1-2 minutes, then gradually add the stock, stirring to avoid lumps. Simmer until thickened, then stir in the milk, mustard and thyme.
Fold in the chicken and peas, season well, and simmer for 5 minutes. Leave to cool slightly.
Transfer to a pie dish, top with pastry, trim and crimp the edges, brush with beaten egg, and cut a steam vent. Bake at 200°C (180°C fan) for 30-35 minutes until golden.