UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'br55k2PHw5RokTQ6Gk+vZI7CsV30ks+0tNpBAC7SP8s='
WHERE
key_id = 'd6e6ff169b4554bd30028078426c440b46fbc2c7b8dc14b13dfc1e036d3359d3'
AND (
token = 'br55k2PHw5RokTQ6Gk+vZI7CsV30ks+0tNpBAC7SP8s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)