UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1lmh99IgVxKr9Z0iqfOYvNNvHlm+HRYq00tv8wtSCC4='
WHERE
key_id = 'e0e6ad646c0617c0740bf12270dd1d4628b9e313c3d643c7c89d56ff5d94b221'
AND (
token = '1lmh99IgVxKr9Z0iqfOYvNNvHlm+HRYq00tv8wtSCC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)