UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CpFPYs2Jji8Ey+kXiwQAYbE3VImhwnNT5F3BQn2NZK8='
WHERE
key_id = '9a20d2a6290704fed2d5f06561813eb5811fdc7e57e2c756398949793924ad91'
AND (
token = 'CpFPYs2Jji8Ey+kXiwQAYbE3VImhwnNT5F3BQn2NZK8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)