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