UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TC9vRhefgGTfmttCa7vEZQSQ8L+KJnKPkXBCTZykP6Q='
WHERE
key_id = '8e655871f8161c42cc971ff82afffc246db58e9180692317b2bb10204aaf62a6'
AND (
token = 'TC9vRhefgGTfmttCa7vEZQSQ8L+KJnKPkXBCTZykP6Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)