UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EIM9358qEc6lc4ZaAZLYfJb66hw/sTI/9ESH/I+H3UY='
WHERE
key_id = 'c08f1cab1d9f493d52d0449a4969924e5e69ac7c6836217cd7e1339ffeaacb6d'
AND (
token = 'EIM9358qEc6lc4ZaAZLYfJb66hw/sTI/9ESH/I+H3UY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)