A two-term time-fractional diffusion equation is studied, subject to a non-local boundary condition. The fractional time derivatives are described in the Caputo sense. We develop a bivariate operational calculus for this problem and apply it to obtain a Duhamel-type representation of the solution. This is a compact representation, containing two convolution products of special solutions and the arbitrary initial and boundary functions. With respect to the space variable a non-classical convolution is used. To find the special solutions, appropriate spectral projection operators are applied. In this way, the solution is constructed in the form of a series expansion on the generalized eigenfunctions of a non-selfadjoint Sturm–Liouville problem and three-parameter Mittag-Leffler functions. Thanks to the uniqueness property of the employed spectral expansion, the uniqueness of the solution is also proven.