In two-way time-of-arrival (TOA) systems, a user device (UD) obtains its position and timing information by round-trip communications to a number of anchor nodes (ANs) at known locations. Compared with the one-way TOA technique, the two-way TOA scheme is easy to implement and has higher localization and synchronization accuracy. Existing two-way TOA methods assume a stationary UD. This will cause uncompensated position and timing errors. In this article, we propose an optimal maximum likelihood (ML) based two-way TOA localization and synchronization method, namely TWLAS. Different from the existing methods, it takes the UD mobility into account to compensate the error caused by the UD motion. We analyze its estimation error and derive the Cramer-Rao lower bound (CRLB). We show that the conventional two-way TOA method is a special case of the TWLAS when the UD is stationary, and the TWLAS has high estimation accuracy than the conventional one-way TOA method. We also derive the estimation error in the case of deviated UD velocity information. Numerical result demonstrates that the estimation accuracy of the new TWLAS for a moving UD reaches CRLB, better than that of the conventional one-way TOA method, and the estimation error caused by the deviated UD velocity information is consistent with the theoretical analysis.