UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'y8Al9XGhsDorasl4hpl9u1sTJ21MwgYFee7d6ZiSvNc='
WHERE
key_id = '9ccaf742dc18a4b373c26eb24dd639d92235c6420af09a340b61e05d155d9626'
AND (
token = 'y8Al9XGhsDorasl4hpl9u1sTJ21MwgYFee7d6ZiSvNc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)