...and I hope you used a proper TOTP method to generate and validate this 6-digit code!
Send them a random number. If you really need it time-based then store the expiry time along with the code you sent them.
Anytime you check the code you see if $current_time is greater than the $expiry_time.