T-test are useful if the data is normally distributed and iid (@djima thank you). If the effect size is large you can use the t-test also if the sample size is small. So yes, you can use a t-test with a sample size which is smaller than 30. The effect size can be calculated with Cohen's D.. Under certain circumstances other measures such as the Glass Delta or the Hedges G are more useful.
"The present simulation study showed that there is
no fundamental objection to using a regular t-test with
extremely small sample sizes. Even a sample size as
small as 2 did not pose problems. In most of the
simulated cases, the Type I error rate did not exceed
the nominal value of 5%. A paired t-test is also feasible
with extremely small sample sizes, particularly when the
within-pair correlation coefficient is high. (de Winter, 2013, p. 7)
J.C.F. de Winter (2013),
"Using the Student’s t-test with extremely small sample sizes,"
Practical Assessment, Research and Evaluation, 18:10, August, ISSN 1531-7714