UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TTYPrH389/jfFe4bMbjUcPsQXJzbgp5vYmFB/s5zopc='
WHERE
key_id = 'dd0bbd3921b3ff137513d28f0749e87a11e80941d5ddbf441d6a3896ffe28c7e'
AND (
token = 'TTYPrH389/jfFe4bMbjUcPsQXJzbgp5vYmFB/s5zopc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)