UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CC9BI8KoccHOW2D1WtS0R3vgJ+pIWCD8TOG7bIwaI0w='
WHERE
key_id = 'ac6647a177d89013a3ba1bc51b8620d85426b584d0c2275e072c27aa21cb2065'
AND (
token = 'CC9BI8KoccHOW2D1WtS0R3vgJ+pIWCD8TOG7bIwaI0w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)