UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M8+dDiXfQq7jxvjcF1/7rn8NNHCw3dYweqBGaV9aqrM='
WHERE
key_id = '733868cb9d030a41c77cf17b06f341ed71d9dc883eb9bb047b89f1003b5e6ca1'
AND (
token = 'M8+dDiXfQq7jxvjcF1/7rn8NNHCw3dYweqBGaV9aqrM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)