UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P0alGmxIxA+mQi7figofX5rCFK6YV2ayWr8LFXOHuCk='
WHERE
key_id = 'b37046e7bccd2c59f902f566d16c3470040f71ed27323ef134e9fc8073c20fb0'
AND (
token = 'P0alGmxIxA+mQi7figofX5rCFK6YV2ayWr8LFXOHuCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)