UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HtytHCodDHEt0d1xj7OUbFFrn5UIVkBMc3m0qQQuUQk='
WHERE
key_id = 'c15e43cf2b3c3427096a22be0b408af0d4730a37fb6d6bf0db33df4a10e866c6'
AND (
token = 'HtytHCodDHEt0d1xj7OUbFFrn5UIVkBMc3m0qQQuUQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)