UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9f1rfsQAq+hV22lSfV3tgVryIQtWrbAOpPl++I6Imi4='
WHERE
key_id = 'b29bd71f257352e3337f459d461023ca4bb9714e67f04c52cf4d017cff5e6996'
AND (
token = '9f1rfsQAq+hV22lSfV3tgVryIQtWrbAOpPl++I6Imi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)