UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XdVDN/5sQqTWKzuprPOnkjOk3HP69QQBAU7/VewfIRc='
WHERE
key_id = '712c4a76ce112277a38c2bb00e5a359c08a5773061360bc0fba39522053687dd'
AND (
token = 'XdVDN/5sQqTWKzuprPOnkjOk3HP69QQBAU7/VewfIRc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)