UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uZvePJmf+3f0vrcwZIoRwBFggcNGD62xAAYohRAH2HE='
WHERE
key_id = '6e9d6032f4660f0d33e7c76d4761b3653bafee6b87e06bb74852365cea3b6078'
AND (
token = 'uZvePJmf+3f0vrcwZIoRwBFggcNGD62xAAYohRAH2HE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)