UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C7efJLZynXCzVqoxN1cjQf9aZBkCecPfhUW+BowfKYw='
WHERE
key_id = 'be9b359c6378a2571612aad4162dce595bb07675a955079d16c0d06fc39e27c8'
AND (
token = 'C7efJLZynXCzVqoxN1cjQf9aZBkCecPfhUW+BowfKYw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)