UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A9H8preuDAs+2R660hbotxoSokYmjMyzrEhO6E7iwEk='
WHERE
key_id = '0dc191a168a1a993c7296225a4ce7baa7486d79e65e8b224978a30fcd7b81311'
AND (
token = 'A9H8preuDAs+2R660hbotxoSokYmjMyzrEhO6E7iwEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)