UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y0qAkq+chR+yDmOn26qonZfU1xwoDS9Lg3m6aURAGow='
WHERE
key_id = 'dc5d13887e1496442110c769661d04bb90aedf43488e4e56ea6db63ba7a5a100'
AND (
token = 'y0qAkq+chR+yDmOn26qonZfU1xwoDS9Lg3m6aURAGow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)