UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CMCB/T+7/dj3793LXG5uZ7pcOzQNvXcmkkehAx7IqVk='
WHERE
key_id = 'e9dae5b18b812b4b88777dcc443a818f51444269df99c7422a387a070c2c31db'
AND (
token = 'CMCB/T+7/dj3793LXG5uZ7pcOzQNvXcmkkehAx7IqVk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)