Add the tomatoes, apple, onion, garlic and water to a medium saucepan. Bring to a gentle simmer over medium heat, then cook uncovered for 15–20 minutes, stirring occasionally, until the apple and onion are soft.
Remove from the heat and blend until smooth using a stick blender or countertop blender. If using whole spices later, they will need removing before the final blend or strain.
Return the sauce to the pan. Stir in the malt vinegar, treacle or syrup, tamarind paste, Worcestershire sauce, soy sauce, ginger, allspice, cloves and mustard powder.
Simmer gently, uncovered, for 25–40 minutes, stirring regularly, until the sauce darkens, thickens and coats the back of a spoon.
Let a spoonful cool slightly before tasting. Add more vinegar for sharpness, a little more sweetener if too sharp, or a splash of water if the flavour is too intense. Stir in the espresso at the end if using, then simmer for 2–3 minutes.
Remove any whole spices. For a smoother finish, pass through a fine sieve. Cool completely, then transfer to a clean jar or bottle and refrigerate.