UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g91vyh23iCD3EfFdrPs5SoO4yNngwGskLpEdIbVbIxI='
WHERE
key_id = '04f1549d6928fa75a6f4512d09e3e6efb01d8bf3f4fd5d276d3eca59f0c8f598'
AND (
token = 'g91vyh23iCD3EfFdrPs5SoO4yNngwGskLpEdIbVbIxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)