A class of optimal three-weight cyclic codes of dimension 3 over any finite field was presented by Vega [Finite Fields Appl., 42 (2016) 23-38]. Shortly thereafter, Heng and Yue [IEEE Trans. Inf. Theory, 62(8) (2016) 4501-4513] generalized this result by presenting several classes of cyclic codes with either optimal three weights or a few weights. On the other hand, a class of optimal five-weight cyclic codes of dimension 4 over a prime field was recently presented by Li, et al. [Adv. Math. Commun.,13(1) (2019) 137-156]. One of the purposes of this work is to present a more general description for these optimal five-weight cyclic codes, which gives place to an enlarged class of optimal five-weight cyclic codes of dimension 4 over any finite field. As an application of this enlarged class, we present the complete weight enumerator of a subclass of the optimal three-weight cyclic codes over any finite field that were studied by Vega [Finite Fields Appl., 42 (2016) 23-38]. In addition, we study the dual codes in this enlarged class of optimal five-weight cyclic codes, and show that they are cyclic codes of length q 2 − 1, dimension q 2 − 5, and minimum Hamming distance 4. In fact, through several examples, we see that those parameters are the best known parameters for linear codes.