UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4A3xYnY01pE4kOXl7+feCVnkVDoBp4KLID28WJA+dlw='
WHERE
key_id = 'f3a3d60bc249bc9cdf261505f946bfeece66f58bf4ee48870768beff6019644a'
AND (
token = '4A3xYnY01pE4kOXl7+feCVnkVDoBp4KLID28WJA+dlw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)